home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / share / hplip / devicesettings.py < prev    next >
Text File  |  2009-10-09  |  2KB  |  87 lines

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # (c) Copyright 2003-2008 Hewlett-Packard Development Company, L.P.
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  19. #
  20. # Author: Don Welch
  21. #
  22.  
  23. __version__ = '0.1'
  24. __title__ = 'Device Setup Utility'
  25. __mod__ = 'hp-devicesettings'
  26. __doc__ = "Device settings utility for HPLIP supported printers. (Note: Not all printers require the use of this utility)."
  27.  
  28. #Std Lib
  29. import sys
  30. import re
  31. import getopt
  32. import time
  33. import operator
  34. import os
  35.  
  36. # Local
  37. from base.g import *
  38. from base import device, utils, maint, tui, module
  39. from prnt import cups
  40.  
  41.  
  42. try:
  43.     mod = module.Module(__mod__, __title__, __version__, __doc__, None,
  44.                        (GUI_MODE,), (UI_TOOLKIT_QT4,))
  45.  
  46.     mod.setUsage(module.USAGE_FLAG_DEVICE_ARGS,
  47.                  see_also_list=['hp-toolbox'])
  48.  
  49.  
  50.     opts, device_uri, printer_name, mode, ui_toolkit, lang = \
  51.         mod.parseStdOpts()
  52.  
  53.     device_uri = mod.getDeviceUri(device_uri, printer_name,
  54.                                   filter={'power-settings': (operator.gt, 0)})
  55.  
  56.     if not utils.canEnterGUIMode4():
  57.         log.error("%s -u/--gui requires Qt4 GUI support. Exiting." % __mod__)
  58.         sys.exit(1)
  59.  
  60.     try:
  61.         from PyQt4.QtGui import QApplication
  62.         from ui4.devicesetupdialog import DeviceSetupDialog
  63.     except ImportError:
  64.         log.error("Unable to load Qt4 support. Is it installed?")
  65.         sys.exit(1)
  66.  
  67.     #try:
  68.     if 1:
  69.         app = QApplication(sys.argv)
  70.  
  71.         dlg = DeviceSetupDialog(None, device_uri)
  72.         dlg.show()
  73.         try:
  74.             log.debug("Starting GUI loop...")
  75.             app.exec_()
  76.         except KeyboardInterrupt:
  77.             sys.exit(0)
  78.  
  79.  
  80.  
  81. except KeyboardInterrupt:
  82.     log.error("User exit")
  83.  
  84. log.info("")
  85. log.info("Done.")
  86.  
  87.